<?php
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ～ ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------

namespace catchAdmin\disease\model;

use app\common\model\BaseModel;
use catchAdmin\permissions\model\Users;
use catcher\base\CatchModel;
use catcher\traits\db\ScopeTrait;

class DiseaseTemplate extends BaseModel
{
    protected $name = 'disease_template';


    public function getLists(int $userId, int $type): \think\Paginator
    {

        $result = $this->where("creator_id", "=", $userId);
        if ($type == 0) {
            $result = $result->whereNull("type");

        } else {
            $result = $result->where("type", "=", $type);
        }

        return $result->paginate($this->pageLimit);

    }

}